package com.example.cabarcenov_0_1;




import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.FrameLayout;
import android.widget.ImageView;

import com.example.cabarcenov_0_1.MapaSensible.ImageMap;
import com.example.cabarcenov_0_1.MapaSensible.ImageMap.Area;


public class Ruta_personalizada extends Activity {
	ImageView im;
	ImageMap mImageMap;
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.layout_personalizada);
		
		  // find the image map in the view
        mImageMap = (ImageMap)findViewById(R.id.image);
	    mImageMap.setImageResource(R.drawable.planocabarceno);
	     im=new ImageView(this);
	    	    
        
        // add a click handler to react when areas are tapped
        mImageMap.addOnImageMapClickedHandler(new ImageMap.OnImageMapClickedHandler()
        {
			@Override
			public void onImageMapClicked(int id, ImageMap imageMap)
			{
				
				// when the area is tapped, show the name in a 
				// text bubble
				
				Log.wtf("ID", ""+id);
				mImageMap.showBubble(id);
				ArrayList<Area> areas=mImageMap.getmAreaList();
				for(Area a:areas){
					if(a.getName().equals("Inicio")){
						try{
							im.setImageResource(R.drawable.inicio);
						
						}catch(NullPointerException ex){
							Log.wtf("Mensaje: ", ex.getLocalizedMessage());
						}
						
						
					}
				}
				
			}

			@Override
			public void onBubbleClicked(int id)
			{
				// react to info bubble for area being tapped
			}
		});
    }
	}

	
